<?php
session_start();
require '../nette/Nette/loader.php';
require '../db.php';
require '../localization/lang.php';
require '../core/core.sanitizer.php';
require '../core/core.security.php';
require '../core/core.time.php';
require '../core/core.attendance.php';

$login=new core_security;
if ($login->checklogin()=="OK") {

$date=new core_time;
$date->date=$_SESSION['date2'];
$date->time="00:00";
//$timestamp=$date->totimestamp();
$timestamp=strtotime($_SESSION['date']);

$date->time=$_POST['value'];
if ($date->verify_time_format_wodate() == "") {

$sec=$date->tosec($_POST['value']);

$att=new core_attendance;
if ($_POST['id'] == "") {
	$att->uid=$_SESSION['uid'];
	$att->day=$timestamp;
	$att->att=$sec;
	$att->add();
	} else {
	$att->id=$_POST['id'];
	$att->uid=$_SESSION['uid'];
	$att->att=$sec;
	$att->edit();
	}
echo $_POST['value'];
}




}
